<?php

session_start();
include_once "../regsettings.php";

include_once "../" . REG_CONNECT_FILE;
include_once "../" . REG_QUERY_FILE;

$basedir = $_SERVER['DOCUMENT_ROOT'];
$webdir = $_REQUEST['webdir'];
$dirname = $basedir . $webdir;
$dir = opendir($dirname);
?>

<html>
<head><title>List</title></head>
<body>

<pre>
<?php

echo(" Loading Files from directory: $webdir/<br />");

while(false != ($file = readdir($dir)))
{ // cant seem to filter out directories... work on that later
if(($file != ".") and ($file != "..") and (!is_dir($webdir . '/' . $file)))
	{
		echo("$webdir/$file <br />");
		$qry_insert_page = "INSERT IGNORE INTO " . REG_PAGES_TABLE . " (page_name) VALUES ('$webdir/$file')";
		do_query($qry_insert_page);
	}
}
?>

</pre>
<p><a href='list_pages.php'> Load another directory </a></p>
<p><a href='../users_list.php'> Users List </a>
</body>
</html>